<%@ page import="org.springframework.web.context.WebApplicationContext" %>
<%@ page import="com.mg.service.DataCodeService" %>
<%@ page import="com.mg.model.DataCode" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="com.mg.service.UserService" %>
<%@ page import="com.mg.model.BankCard" %>
<%@ page import="com.mg.model.User" %>
<%@ page import="java.math.BigDecimal" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="../../common/taglibs.jsp" %>
<html>
<%
    WebApplicationContext context = (WebApplicationContext) request.getServletContext().getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    DataCodeService dataCodeService = (DataCodeService) context.getBean("dataCodeServiceImpl");
    UserService userService = (UserService) context.getBean("userServiceImpl");

    DataCode dataCode = new DataCode();
    dataCode.setOriCategoryId("1002");
    List<DataCode> dataCodes = dataCodeService.select(dataCode);
    Map<String, String> dataMap = new HashMap<>();
    for (DataCode dataCode1 : dataCodes) {
        dataMap.put(dataCode1.getOriCodeId(), dataCode1.getOriCodeValue());
    }
    User user = (User) request.getSession().getAttribute(Constants.USER_INFO);
    List<BankCard> bankCards = userService.getBankCardByUserId(user.getId());
    user = userService.getUser(user.getId());
%>
<head>
    <link rel="stylesheet" type="text/css" href="${ctx}/pages/account/css/account.css">
</head>
<body>
<div class="demo-content account">
    <div class="row ">
        <div class="span24">
            <div id="tab"></div>
            <div class="recharge">
                <label class="recharge-label" style="font-size:16px;">充值金额</label>
                <div class="recharge-inline">
                    <input type="number" name="title" class="rechargeNum" required="" lay-verify="required"
                           placeholder="请输入充值金额"
                           autocomplete="off" style="font-size:16px;">
                </div>
                <button name="recharge" class="button-size button button-success  rechargeBtn"
                        style="  margin-top: 5px;">
                    立即提交
                </button>
                <button class="button-size button rechargeReset " style="  margin-top: 5px;">重置</button>
            </div>
            <div style="display: none" class="present">
                <div class="row present-item">
                    <label>可用余额：</label>
                    <span class="balance"><%=user.getBalance().subtract(user.getFrozeMoney()).setScale(3,BigDecimal.ROUND_DOWN)%>元</span>
                </div>
                <div class="row present-item">
                    <label class="control-label">提现银行：</label>
                    <div class="bankInfo">
                        <p><input type="radio" name="bankInfo"/>解决方法一</p>
                        <p><input type="radio" name="bankInfo"/>解决方法二</p>
                    </div>
                </div>
                <div class="row present-item">
                    <label>提现金额：</label>
                    <div class="present-inline">
                        <input type="number" class="presentNum" name="title" required="" lay-verify="required"
                               placeholder="请输入提现金额"
                               autocomplete="off" style="font-size:16px; margin-top: 2px;">
                    </div>
                </div>
                <div class="row present-item">
                    <button name="present" class="button button-success presentBtn button-size"
                            style="margin-left: 75px">立即提交
                    </button>
                    <button type="reset" class="button presentReset button-size">重置</button>
                </div>
            </div>
            <div class="account-detail" style="display: none; margin-top: 10px">
                <div style="width: 400px;height: 300px;   float: left; ">
                    <div class="detail">汇款账号如下：</div>
                    <div class="bank-img"></div>
                </div>
                <div class="account-bank">
                    <div>&nbsp;</div>
                    <input type="hidden" class="rechargeId">
                    <div>账户名称：<%=dataMap.get("carName")%>
                    </div>
                    <div>银行账号：<%=dataMap.get("carNo")%>
                    </div>
                    <div>开户银行：<%=dataMap.get("bankName")%>
                    </div>
                    <div>分行信息：<%=dataMap.get("bankInfo")%>
                    </div>
                    <div>付款金额：<span style="color:#D9534F;" class="money1">1</span>元</div>
                    <div>汇款备注：<span style="color:#D9534F;" class="remark">763</span></div>
                </div>
                <div>
                    <button class="button-size rechargeCompleted button button-success"
                            style=" background-color:#44B549">已完成转账
                    </button>
                    <button class="button-size rechargeCancel button button-info ">取消充值</button>
                </div>

            </div>
        </div>

    </div>
</div>
</div>
</div>
<script type="text/javascript">
    var bankCards =
    <%=JsonUtils.toJson(bankCards)%>
</script>
<%@ include file="../../common/head.builive.inc.jsp" %>
<%@ include file="../../common/session.script.inc.jsp" %>
<script type="text/javascript" src="${ctx}/pages/account/js/account.js"></script>
</body>
</html>